

import request from '@/router/axios';

const storeApi = {
    getMarketList: '/online/app/market/list',
    setup: '/api/Cgs/Portal/Import',
    setupAPP: '/api/app/import'
}


// export function saveForm (params) {
//     return request({
//       url: vformAPI.saveVForm,
//       method: 'post',
//       data: params
//     })
//   }

  export function getMarketList () {
    return new Promise((resolve, reject) => {
      request({
        url: storeApi.getMarketList,
        method: 'get'
      }).then(res => {
        if(res.status === 200 && res.data.code === 200){
          resolve(res.data.data)
        } else {
          resolve(false)
        }
      })
    })
  }

  export function setup (params) {
    return new Promise((resolve, reject) => {
      request({
        url: storeApi.setup,
        method: 'post',
        data: params,
        headers: {
            "Content-Type": "multipart/form-data"
        }
      }).then(res => {
        if(res.status === 200 && res.data.code === 200){
          resolve(true)
        } else {
          resolve(false)
        }
      })
    })
  }

  export function setupAPP (params) {
    return new Promise((resolve, reject) => {
      request({
        url: storeApi.setupAPP,
        method: 'post',
        data: params,
        headers: {
            "Content-Type": "multipart/form-data"
        }
      }).then(res => {
        if(res.status === 200 && res.data.code === 200){
          resolve(true)
        } else {
          resolve(false)
        }
      })
    })
  }